package com.example.demo.service.impl;

import com.example.demo.dao.AdRepository;
import com.example.demo.model.entity.AdModel;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class AdService {

    @Resource
    AdRepository adRepository;

    public AdModel save(AdModel model) {
        return adRepository.save(model);
    }


    public Page<AdModel> getAdPage(Specification specification, Pageable pageable) {
        return adRepository.findAll(specification, pageable);
    }


    public void delete(String adId) {
        adRepository.delete(adId);
    }
}
